﻿Imports System.Data.SqlClient
Imports PhDir.Model

Namespace Repository.DataReader
    Public Class PhoneReader
        Implements IDataReader(Of Model.Phone)

        Friend Sub New()
            Me.UserReader = New UserReader()
        End Sub

        Private Property UserReader As UserReader

        Public Function Read(sqlDataReader As SqlDataReader) As Model.Phone _
            Implements IDataReader(Of Model.Phone).Read

            Dim user = Me.UserReader.Read(sqlDataReader)
            Dim phone = New Model.Phone With
                        {
                            .User = user,
                            .PhoneNumber = sqlDataReader("Phone")
                        }
            Return phone

        End Function
    End Class
End Namespace
